import { createRouter, createWebHistory, createWebHashHistory } from "vue-router";

const routes = [
    {
        path: "/",
        redirect: "/hotel",
    },
    {
        path: "/hotel",
        name: "Hotel",
        component: () => import("@/views/hotel/index.vue"),
        meta: { title: "酒店Dashboard" },
    },
    {
        path: "/office",
        name: "Office",
        component: () => import("@/views/office/index.vue"),
        meta: { title: "集团Dashboard" },
    },
];
const router = createRouter({
    routes,
    history: createWebHashHistory(),
    scrollBehavior: () => {
        return { top: 0 };
    },
});

router.beforeEach((to, from, next) => {
    document.title = to.meta.title || "pms";
    next();
});

export default router;
